<%@page import="model.Rating"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.List"%>
<%@page import="javax.servlet.http.HttpServletRequest"%>
<%!
	private int getNumberOfValue(int value, HttpServletRequest request){
		@SuppressWarnings("unchecked")
		List<Rating> ratingList = (List<Rating>) request.getAttribute("ratingList");
		int result = 0;
		
		if (ratingList != null) {
			Iterator<Rating> j = ratingList.iterator();
			while(j.hasNext()) {
				Rating rating = j.next();
				if (rating.getValue() == value)
					result = result + 1;
			}
		}
		return result;
	}
%>
<%
	for (int i=5; i>=1; i--){
		out.print("<img src=\"" + request.getContextPath() + "/images/etoile_petite_" + i + ".png\"></img>");
		out.print("<label>&nbsp;" + getNumberOfValue(i,request) + " avis </label>");
		out.print("<br/>");	
	}
%>





